package com.itany.corejava.code06_面向对象.继承;

/**
 * @author 石小俊
 * @date 2024年01月16日 14:01
 */
public class Person {
    private String name;
    private int age;
    private String gender;

    public void show() {
        System.out.println("姓名:" + name + ",年龄:" + age + ",性别:" + gender);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }
}

class Man extends Person {
    private double salary; // 工资

    public void work() {
        System.out.println("男人负责赚钱养家,每个月收入" + salary + "元");
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
}

class WoMan extends Person {
    private int appearance; // 颜值,1-100

    public void shopping() {
        System.out.println("女人负责貌美如花,挂逛街,购购物,颜值:" + appearance);
    }

    public int getAppearance() {
        return appearance;
    }

    public void setAppearance(int appearance) {
        this.appearance = appearance;
    }
}

class TestPerson {

    public static void main(String[] args) {
        Man man = new Man();
        man.setSalary(8000);
        man.setName("admin");
        man.setAge(30);
        man.setGender("男");
        man.show();
        man.work();

        WoMan woMan = new WoMan();
        woMan.setAppearance(100);
        woMan.setAge(18);
        woMan.setName("alice");
        woMan.setGender("女");
        woMan.show();
        woMan.shopping();
    }


}
